Skip to content

Instantly share code, notes, and snippets.

@tjmehta
tjmehta / dataview-polyfill.js
Created April 5, 2016 00:05
DataView (and ArrayBuffer) polyfill that works in any engine (including old IE).
void function(global){
if ('DataView' in global && 'ArrayBuffer' in global) {
return;
}
var hide = (function(){
// check if we're in ES5
if (typeof Object.getOwnPropertyNames === 'function' && !('prototype' in Object.getOwnPropertyNames)) {
var hidden = { enumerable: false };
@Nexarian
Nexarian / xrdp-intel-setup.sh
Last active May 8, 2024 19:47
Setup for Intel acceleration and XRDP
#!/usr/bin/env bash
set -e
sudo -v
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 19:42
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@kylerummens
kylerummens / supabase-angular-auth-with-rxjs.md
Created December 18, 2022 05:43
Supabase Angular authentication with RxJS Observables

Overview

The goal of this example is to build a more powerful authentication system in our Supabase Angular applications by leveraging RxJS Observables.

Supabase has a great tutorial that explains how to set up your Angular app to work with Supabase, but while that tutorial works with Angular, I wouldn't say it's built for angular.

When you create a new Angular app with the Angular CLI, baked-in is the powerful library, RxJS. Let's combine the ease of Supabase with the power of RxJS.

Another important addition that I will lay out is the ability to seamlessly combine a public.profiles table with your auth.users table from Supabase Auth. Many (if not most) applications need to store more data about their users than what sits in the auth.users table in your database, which is where Supabase Auth pulls from. With RxJS Observables and Supabase Realtime, any changes to our user's profile can immediately be

Shader "Unlit/PolyRhythmVisualizer" {
Properties {
_TimeCode ("Input Time", Float) = 0
_OuterRingFreq ("Outer Ring Frequency", Float) = 1
_InnerRingFreq ("Inner Ring Frequency", Float) = 0.922
_RingCount ("Ring Count", Int) = 35
_VibrantFreq ("Vibrant Frequency", Float) = 2
_Vibrant ("Vibrant", Range(0, 1)) = 0.5
_Decay ("Decay", Range(0, 10)) = 2
[Header(Cosine Gradiant)]
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active May 8, 2024 19:35
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
div.field_with_errors label{color:#d4524b !important}div.field_with_errors input:not(.custom-tailwind){border:2px solid #d4524b !important}div.field_with_errors+.input-wrapper{border:2px solid #d4524b !important}[data-controller=character-count].warn .count-label{color:#f5a623}[data-controller=character-count].alert .count-label{color:#d4524b}fieldset{border:none}fieldset label{display:block;color:#333;font-size:18px;font-weight:bold;margin:40px 0 6px 0}fieldset label.p-0{padding:0}fieldset label.m-0{margin:0}fieldset label.radio_description{display:inline;color:#666;font-weight:normal;margin:0}fieldset label small{font-weight:normal;color:#999;padding-left:10px}fieldset label small.warn{color:#f5a623}fieldset label small.alert{color:#d4524b}fieldset i{color:#999;display:block;font-size:14px;font-style:normal;padding:7px 0 0 2px}input[type=text],input[type=email],input[type=number],input[type=password],fieldset input,fieldset textarea,fieldset select{border:2px solid #434459;border-radius:5px;box-sizing:borde
@sohamkamani
sohamkamani / rsa.js
Last active May 8, 2024 19:32
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
})